<template>
  <view class="main" v-if="isShowDialog" @touchmove.stop.prevent="">
    <view class="mainContent">
      <view class="title">{{ titleTxt || "温馨提示" }}</view>
      <view class="content">{{ descTxt }}</view>
      <view class="btn">
        <view class="btn_cancel" @click="onCancelClick">取消</view>
        <view class="btnCommit" @click="onCommitClick">{{
          commitTxt || "确认"
        }}</view>
      </view>
    </view>
  </view>
</template>

<script setup>
import {
  defineProps,
  defineEmits,
  ref,
  onMounted,
  getCurrentInstance,
} from "vue";

let { proxy } = getCurrentInstance();
defineProps(["isShowDialog", "titleTxt", "descTxt", "commitTxt"]);
let emits = defineEmits(["commit"]);
const onCommitClick = () => {
  emits("commit");
};
const onCancelClick = () => {
  emits("cancel");
};
</script>

<style scoped lang="scss">
.main {
  width: 100%;
  height: 100%;
  position: fixed;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  background-color: rgba(0, 0, 0, 0.4);
  box-sizing: border-box;
}
.btn {
  display: flex;
  justify-content: space-between;
}
.btn_cancel {
  background: #ccc;
  border-radius: 50rpx;
  font-size: 0.9375rem;
  font-weight: 400;
  color: #ffffff;
  padding: 20rpx 70rpx;
  letter-spacing: 0.03125rem;
  margin-right: 20rpx;
}
.mainContent {
  width: 70%;
  height: 18%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  background-color: #ffffff;
  border-radius: 40rpx;
  padding: 30rpx;
}

.title {
  font-size: 40rpx;
  font-weight: bold;
  color: #3d3d3d;
  letter-spacing: 1rpx;
}

.content {
  flex: 1;
  box-sizing: border-box;
  padding: 0 60rpx;
  margin-top: 20rpx;
  font-size: 30rpx;
  font-weight: 400;
  color: #3d3d3d;
}

.btnCommit {
  background: $color_def;
  border-radius: 50rpx;
  font-size: 30rpx;
  font-weight: 400;
  color: #ffffff;
  padding: 20rpx 70rpx;
  letter-spacing: 1rpx;
}
</style>
